using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using RMAS.DAL;

namespace APP.QUANLY.Common
{
    public class StaticVar
    {
        private SqlConnection _con;

        public SqlConnection con
        {
            get { return _con; }
            set { ServerConnection = _con = con; }
        }

        public StaticVar(SqlConnection con)
        {
            this._con = con;
        }

        #region Quan Trong Khong Duoc Xoa
        public static IDbConnection ServerConnection;
        public static bool IsServer=false;
        public static string CPUID = "";
        public static string MaKho = "WH.1";
        #endregion

        public static List<String> ListPermission = null;
        public static DM_USER CurrUSER = null;
        public static DM_GROUPMENUList DanhSachNhomThucDon = null;
        public static DM_MENUList DanhSachThucDon = null;
        public static DM_UNITList DanhSachDonVi = null;
        public static DM_AREAList DanhSachKhuVuc = null;
        public static DM_TABLEList DanhSachBan = null;
        public static DM_METERIALGROUPList DanhSachNhomNguyenVatLieu = null;
        public static DM_METERIALUNITList DanhSachDonViNVL=null;
        public static DM_METERIALList DanhSachNguyenVatLieu = null;
        public static DM_WAREHOUSEList DanhSachKhoSP = null;
        public static DM_WAREHOUSEMETERIALList DanhSachKhoNVL = null;
        public static DM_PARTNERINFOList DanhSachKhacHang = null;
        public static DM_PARTNERINFOList DanhSachNhaCungCap = null;
        public static WAREHOUSE_PRODUCTList DanhSachTonKhoSanPham = null;
        public static DM_WAREHOUSEMETERIALList DanhSachTonKhoNguyenVatLieu = null;

        public static int SoBanTrong = 0;
        public static int SoBanSuDung = 0;
        public static int SoBanDat = 0;
        public static int SoBanGhep = 0;
        
        public static DM_BRANCH CurrBranch = null;

        public static void LoadAllData()
        {
            try
            {
                DM_TABLE_Provider _provTable = new DM_TABLE_Provider();
                DM_AREA_Provider _provArea = new DM_AREA_Provider();
                DM_UNIT_Provider _provUnit = new DM_UNIT_Provider();
                DM_GROUPMENU_Provider _provGrpMenu = new DM_GROUPMENU_Provider();
                DM_MENU_Provider _provMenu = new DM_MENU_Provider();
                DM_METERIAL_Provider _provMeterial = new DM_METERIAL_Provider();
                DM_METERIALUNIT_Provider _provUnitMete = new DM_METERIALUNIT_Provider();
                DM_METERIALGROUP_Provider _provGroupMete = new DM_METERIALGROUP_Provider();
                DM_WAREHOUSE_Provider _provWare = new DM_WAREHOUSE_Provider();
                DM_WAREHOUSEMETERIAL_Provider _provWareMete = new DM_WAREHOUSEMETERIAL_Provider();
                DM_PARTNERINFO_Provider _provPartner =new DM_PARTNERINFO_Provider();
                WAREHOUSE_PRODUCT_Provider _provWarepro = new WAREHOUSE_PRODUCT_Provider();

                DanhSachKhuVuc = _provArea.GetAll();
                DanhSachBan = _provTable.GetAll();
                DanhSachDonVi = _provUnit.GetAll();
                DanhSachNhomThucDon = _provGrpMenu.GetAll();
                DanhSachThucDon = _provMenu.GetAll();
                DanhSachNguyenVatLieu = _provMeterial.GetAll();
                DanhSachDonViNVL = _provUnitMete.GetAll();
                DanhSachNhomNguyenVatLieu = _provGroupMete.GetAll();
                DanhSachKhoSP = _provWare.GetAll();
                DanhSachKhoNVL = _provWareMete.GetAll();
                DanhSachKhacHang = _provPartner.GetAll(true);
                DanhSachNhaCungCap = _provPartner.GetAll(false);
                DanhSachTonKhoSanPham = _provWarepro.GetAll();
                DanhSachTonKhoNguyenVatLieu = _provWareMete.GetAll();
            }
            catch { }
        }
    }
    public enum TrangThai
    {
        BanTrong = 0,
        BanSuDung = 1,
        BanGhep = 2,
        BanDat = 3
    }
}
